
/**
 * \file
 *          tlmRmtCfgSrvRpcCommonDesc.cpp
 * \brief
 *          RPC common descriptor implementation file.
 * TODO:add author information at here
 * \par Copyright Notice:
 * Copyright (C) 2011 Continental Automotive Singapore Pte Ltd.
 * Alle Rechte vorbehalten. All Rights Reserved.\n
 * The reproduction, transmission or use of this document or its contents is
 * not permitted without express written authority.\n
 * Offenders will be liable for damages. All rights, including rights created
 * by patent grant or registration of a utility model or design, are reserved.
 *
 * \ingroup GEN_TELE_RMT_CFG
 */

#include "tlmRmtCfgSrvRpcCommonDesc.h"
#include "tlmRmtCfgSrvApp.h"
#include "teleLogTrace.h"


//==============================================================================
// IMPLEMENTATION
//==============================================================================

/**
 * \brief	Constructor of tlmRmtCfgSrvRpcCommonDesc
 *
 * TestID: 
 *
 * \param p [in] struct used by RPC framework which consists of calling function id,
 * input & output parameters and etc
 *
 * \return - none
 * */
tlmRmtCfgSrvRpcCommonDesc::tlmRmtCfgSrvRpcCommonDesc(RPC_IOCTL_PTR p) : pIOCTL(p) {
    //#[ operation tlmRmtCfgSrvRpcCommonDesc(RPC_IOCTL_PTR)
    //#]
}

/**
 * \brief	destructor of tlmRmtCfgSrvRpcCommonDesc

 *
 * \param - none
 *
 * \return - none
 * */
tlmRmtCfgSrvRpcCommonDesc::~tlmRmtCfgSrvRpcCommonDesc() {
    //#[ operation ~tlmRmtCfgSrvRpcCommonDesc()
    //#]
}

/**
 * \brief  execute the corresponding RPC function by caller from another threads
 *
 * TestID: 
 *
 * \param - none
 *
 * \return - none
 */
void tlmRmtCfgSrvRpcCommonDesc::__execute() const {
    //#[ operation __execute()

    if (NIL != this->pIOCTL->ac)
    {
    	switch(this->pIOCTL->dmFuncID)
    	{
		    case FUNCID_TLM_RMT_CFG_HANDLE_MSG:
                {

                    tlmRmtCfgSrvApp * m_pRmtCfgSrv = const_cast<tlmRmtCfgSrvApp*> (tlmRmtCfgSrvApp::GetInstance());
                    if(m_pRmtCfgSrv != NIL)
                    {
                    
                        m_pRmtCfgSrv->__OnReceiveMsg(*(reinterpret_cast<tlmServiceMsg **>(this->pIOCTL->lpInBuffer)));
                    }
                    else
                    {
	                    //LOG_PRINT(DPCA_TELE_MSGSRV_ERROR,"[TLM_MSGSRV]:<tlmRmtCfgSrvRpcCommonDesc::%s>, m_pRmtCfgSrv is NIL\n", __FUNCTION__);
                    }

                    break;
                }

         default:
    		break;
    	}
    }
    else
    {
        // will be replaced by assert or other fallback strategy
    }

    //#]
}

